<?php
/*
Plugin Name: wpdirlist
Plugin URI: http://code.google.com/p/wpdirlist/
Description: Allows you to list directories in pages and posts by using a simple shortcode.
Version: 1.0
Author: Joshua French
Author Email: josh.23.french@gmail.com
*/

/*  Copyright 2009 Joshua French  (email : josh.23.french@gmail.com)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

function wpdirlist_callback( $atts ) {
	extract( shortcode_atts( array(
		'dir' => NULL
	), $atts ) );
	if( $dir == NULL ) return 'You must specify a directory. The syntax for this shortcode is [wpdirlist dir="/path/to/dir/"].';
	return wpdirlist( $dir );
}
function wpdirlist( $dir, $level = 1, $x = '' ) {
	// open dir
	// foreach dir, call this file
	// $x = wpdirlist( $dir, $level+1, $x );
	return $x;
}
add_shortcode( 'wpdirlist', 'wpdirlist_callback' );
